import time

from selenium import webdriver
from selenium.webdriver import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.edge.service import Service

if __name__ == '__main__':
    exe_path = "../driver/msedgedriver.exe"
    service = Service(executable_path=exe_path)
    brower = webdriver.Edge(service=service)

    brower.get(url="https://www.jd.com")

    # 通过 id 查找元素
    element = brower.find_element(by=By.ID, value="key")
    print(element.size)
    # 模拟键盘，向输入框中输入内容
    element.send_keys("华为 P60")
    time.sleep(10)

    element.send_keys(Keys.CONTROL, "A")
    time.sleep(10)
    element.send_keys(Keys.DELETE)


    time.sleep(10)
    brower.quit()